﻿using System.Web.Mvc;
using System.Linq;
using iss.sg4210.se18.team6s.jass.BL;

namespace iss.sg4210.se18.team6s.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        PublishingsFacade publishingFacade = null;
        public HomeController()
        {
            publishingFacade = new PublishingsFacade();
        }

        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to EJASS!";

            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        [ChildActionOnly]
        public ActionResult EventList()
        {
            return PartialView("EventList", publishingFacade.FindAllLatestEvents().Take(5));
        }

        [ChildActionOnly]
        public ActionResult ArticleList()
        {
            return PartialView(publishingFacade.FindAllLatestArticles().Take(5));
        }
    }
}
